package com.hxj.springboot01.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SpringBeansController {

    @Autowired
    private ApplicationContext app;

    @GetMapping("/printAllSpringbootBeanNames")
    public String[] printAllBeanNames() {
        String[] beanNames = app.getBeanDefinitionNames();
        for (String beanName : beanNames) {
            System.out.println("2024springboot已注册的bean："+beanName);
        }
        return beanNames;

    }
}
